/*
 * =====================================================================================
 *
 *       Filename:  sockarr.h
 *
 *    Description:  
 *
 *        Version:  1.0
 *        Created:  2014年08月27日 09时43分55秒
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  jianxi sun (jianxi), ycsunjane@gmail.com
 *   Organization:  
 *
 * =====================================================================================
 */
#ifndef __SOCKARR_H__
#define __SOCKARR_H__
#include <sys/epoll.h>
#include "list.h"

enum {
	MSG_PROTO_ETH = 8000,
	MSG_PROTO_TCP,
};

struct sockarr_t {
	struct list_head list;
	int sock;
	struct epoll_event ev;
	uint32_t bakevent;

	int (*func) (void *);
	void *arg;
};

void sockarr_init();
void sockarr_clr();
void debug_event(uint32_t event);
int sockarr_delete(struct sockarr_t *arr, int sock);
struct sockarr_t * sockarr_insert(int , int (*) (void *), void *);
void * sockarr_recv(void *arg);
int sockarr_send(int, int, unsigned char *, char *, int);

#endif /* __SOCKARR_H__ */
